﻿using HalconDotNet;
using Halcon二次开发.Controller.创建计量模型;
using Halcon二次开发.Controller.定位跟随;
using Halcon二次开发.Controller.数据加载与保存;
using Halcon二次开发.Model;
using Halcon二次开发.Model.储存每个Controller的单例对象;
using Halcon二次开发.Model.储放所有单例.储存每个单例界面;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Halcon二次开发.View.定位跟随
{
    public partial class FixtureToolFForm : Form
    {
        public FixtrueController controller = null;
        MeasurementController measureController = null;
        //Json文件路径
        private string jsonPath;
        //当前窗体的节点
        private string addres;
        public FixtureToolFForm()
        {
            InitializeComponent();
            controller = new FixtrueController(this);
            measureController= new MeasurementController();
        }
        /// <summary>
        /// 反射调用的方法，请不要修改
        /// </summary>
        /// <param name="path">Json文件的路径</param>
        /// <param name="addres">节点</param>
        public void SetJsonPaths(string path,string addres)
        {
            string paths = path + "\\"+"界面数据\\"+addres+"\\"+ addres+"数据.json";
            //调用存储方法
            new LoadData().LoadDatas(paths, this);
        }
        //运行按钮
        private void toolStripButton1_Click_1(object sender, EventArgs e)
        {
            //这里要传入图像路径没写改了,传入中心的坐标
            // controller.Action((int)numericUpDown1.Value,(int)numericUpDown2.Value); 
            try
            {
                controller.Run();
            }
            catch(Exception ex)
            {
                (FormDb.Db["Form1"] as Form1).textBox1.AppendText(this.Name + ":" + ex.Message + "\r\n");
            }
        }
        private void FixtureToolFForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            e.Cancel = true;
        }
    }
}
